From aa1435b7418b0339b66dcb28b553a17c4bd49113 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 16 Sep 2013 14:26:08 -0400 Subject: [PATCH] Include CSD titlebar in focus chain At least for header bars, there's often application controls in this area, which should be included in the focus chain. We make it so that the initial focus avoids the titlebar, but tabbing around will eventually get there. https://bugzilla.gnome.org/show_bug.cgi?id=708067 --- gtk/gtkwindow.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 50ed413162..93422cbbd9 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -7555,7 +7555,7 @@ gtk_window_focus (GtkWidget *widget, bin = GTK_BIN (widget); old_focus_child = gtk_container_get_focus_child (container); - + /* We need a special implementation here to deal properly with wrapping * around in the tab chain without the danger of going into an * infinite loop. @@ -7587,8 +7587,17 @@ gtk_window_focus (GtkWidget *widget, gtk_window_set_focus (GTK_WINDOW (container), NULL); } - /* Now try to focus the first widget in the window */ - child = gtk_bin_get_child (bin); + /* Now try to focus the first widget in the window, + * taking care to hook titlebar widgets into the + * focus chain. + */ + if (priv->title_box != NULL && + old_focus_child != NULL && + priv->title_box != old_focus_child) + child = priv->title_box; + else + child = gtk_bin_get_child (bin); + if (child) { if (gtk_widget_child_focus (child, direction)) -- 2.30.2